var CarSelector = {
	getView : function(i, d, c) {
		var b = null;
		if (d) {
			var b = new Ext.grid.CheckboxSelectionModel({
				singleSelect : true
			});
		} else {
			b = new Ext.grid.CheckboxSelectionModel();
		}
		var h = new Ext.grid.ColumnModel({
			columns : [ b, new Ext.grid.RowNumberer(), {
				header : "carId",
				dataIndex : "carId",
				hidden : true
			}, {
				header : "车辆车牌号",
				dataIndex : "carNo",
				width : 60
			} ]
		});
		var g = new Ext.data.Store({
			proxy : new Ext.data.HttpProxy({
				url : __ctxPath + "/admin/listCar.do"
			}),
			reader : new Ext.data.JsonReader({
				root : "result",
				totalProperty : "totalCounts",
				id : "carId",
				fields : [ {
					name : "carId",
					type : "int"
				}, "carNo" ]
			}),
			remoteSort : true
		});
		var e = new Ext.grid.GridPanel({
			id : "CarSelectorGrid",
			width : 400,
			height : 300,
			region : "center",
			title : "车辆列表",
			store : g,
			shim : true,
			trackMouseOver : true,
			disableSelection : false,
			loadMask : true,
			cm : h,
			sm : b,
			viewConfig : {
				forceFit : true,
				enableRowBody : false,
				showPreview : false
			},
			bbar : new HT.PagingBar({
				store : g
			})
		});
		g.load({
			params : {
				start : 0,
				limit : 10,
				"Q_status_SN_EQ" : c
			}
		});
		var a = new Ext.FormPanel(
				{
					width : 400,
					region : "north",
					id : "CarSearchForm",
					height : 40,
					frame : false,
					border : false,
					layout : "hbox",
					layoutConfig : {
						padding : "5",
						align : "middle"
					},
					defaults : {
						xtype : "label",
						margins : {
							top : 0,
							right : 4,
							bottom : 4,
							left : 4
						}
					},
					items : [
							{
								text : "请输入查询条件:"
							},
							{
								text : "车辆车牌号"
							},
							{
								xtype : "textfield",
								name : "Q_carNo_S_LK"
							},
							{
								xtype : "button",
								text : "查询",
								iconCls : "search",
								handler : function() {
									var j = Ext.getCmp("CarSearchForm");
									var k = Ext.getCmp("CarSelectorGrid");
									if (j.getForm().isValid()) {
										j
												.getForm()
												.submit(
														{
															waitMsg : "正在提交查询",
															url : __ctxPath
																	+ "/admin/listCar.do",
															params : {
																start : 0,
																limit : 10,
																"Q_status_SN_EQ" : c
															},
															method : "post",
															success : function(
																	m, n) {
																var l = Ext.util.JSON
																		.decode(n.response.responseText);
																k
																		.getStore()
																		.loadData(
																				l);
															}
														});
									}
								}
							} ]
				});
		var f = new Ext.Window({
			title : "车辆选择",
			iconCls : "menu-car",
			width : 630,
			height : 380,
			layout : "border",
			border : false,
			items : [ a, e ],
			modal : true,
			buttonAlign : "center",
			buttons : [ {
				iconCls : "btn-ok",
				text : "确定",
				handler : function() {
					var m = Ext.getCmp("CarSelectorGrid");
					var n = m.getSelectionModel().getSelections();
					var j = "";
					var k = "";
					for (var l = 0; l < n.length; l++) {
						if (l > 0) {
							j += ",";
							k += ",";
						}
						j += n[l].data.carId;
						k += n[l].data.carNo;
					}
					if (i != null) {
						i.call(this, j, k);
					}
					f.close();
				}
			}, {
				text : "取消",
				iconCls : "btn-cancel",
				handler : function() {
					f.close();
				}
			} ]
		});
		return f;
	}
};